package smetana.domain.join;

import com.google.common.base.Objects;
import java.math.BigDecimal;

/**
 *
 * @author dmitry.mamonov
 */
public class PriceListImportPosition {
    Integer localId;
    Integer externalId;
    String localProductGroup;
    String localProductName;
    String externalProductGroup;
    String externalProductName;
    BigDecimal localPrice;
    BigDecimal externalPrice;
    Operation operationType;

    public BigDecimal getExternalPrice() {
        return externalPrice;
    }

    public void setExternalPrice(BigDecimal externalPrice) {
        this.externalPrice = externalPrice;
    }

    public Integer getLocalId() {
        return localId;
    }

    public void setLocalId(Integer localId) {
        this.localId = localId;
    }

    public BigDecimal getLocalPrice() {
        return localPrice;
    }

    public void setLocalPrice(BigDecimal localPrice) {
        this.localPrice = localPrice;
    }

    public Operation getOperationType() {
        return operationType;
    }

    public void setOperationType(Operation operationType) {
        this.operationType = operationType;
    }

    public Integer getExternalId() {
        return externalId;
    }

    public void setExternalId(Integer externalId) {
        this.externalId = externalId;
    }

    public String getExternalProductGroup() {
        return externalProductGroup;
    }

    public void setExternalProductGroup(String externalProductGroup) {
        this.externalProductGroup = externalProductGroup;
    }

    public String getExternalProductName() {
        return externalProductName;
    }

    public void setExternalProductName(String externalProductName) {
        this.externalProductName = externalProductName;
    }

    public String getLocalProductGroup() {
        return localProductGroup;
    }

    public void setLocalProductGroup(String localProductGroup) {
        this.localProductGroup = localProductGroup;
    }

    public String getLocalProductName() {
        return localProductName;
    }

    public void setLocalProductName(String localProductName) {
        this.localProductName = localProductName;
    }

    public String getDisplayName(){
        String result = "";
        if (Objects.equal(localProductGroup, externalProductGroup)==true){
            result +=externalProductGroup;
        } else {
            result+=localProductGroup+"->"+externalProductGroup;
        }
        if (result.isEmpty()==false){
            result+=" / ";
        }
        if (Objects.equal(localProductName, externalProductName)==true){
            result+=externalProductName;
        } else {
            result+=localProductName+"->"+externalProductName;
        }
        return result;
    }

    public enum Operation {
        Insert,
        Update;
    }
}
